Skip to content

SpringBoot 的常用注解——导图

SpringBoot 常用注解

组件相关注解

  • @Controller
  • @Service
  • @Repository
  • @Component

依赖注入注解

  • @Autowired
  • @Resource
  • @Qualifier

实例与生命周期相关注解

  • @Bean
  • @Scope
  • @Primary
  • @PostConstruct
  • @PreDestroy
  • @PostConstruct、@PreDestroy

SpringMVC 相关注解

  • @RequestMapping
  • @RequestBody
  • @ResponseBody
  • @RequestParam
  • @PathVariable
  • @RequestPart
  • @RestController
  • @GetMapper
  • @PostMapping

配置相关注解

  • @Configuration
  • @EnableAutoConfiguratioin
  • @ComponentScan
  • @SpringBootApplicatioin
  • @EnableCaching
  • @Value
  • @ConfigurationProperties
  • @Conditional

数据库事务相关注解

  • @EnableTransactionManagement
  • @Transactional

SpringSecurity 相关注解

  • @EnableWebSecurity
  • @EnableGlobalMethodSecurity

全局异常处理注解

  • @ControllerAdvice
  • @ExceptionHandler

AOP 相关注解

  • @Aspect
  • @Before
  • @After
  • @AfterReturning
  • @AfterThrowing
  • @Around
  • @Pointcut
  • @Order

测试相关注解

  • @SpringBoot Test
  • @Test